{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3041
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var 
	i,n:longint; 
	s,t:string;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(S);
readln(n);
for i:=1 to n do begin
	readln(t);
	if t=s then begin
		write('YES');
		halt(0);
	end;
end;
write('NO');
end.